/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package eulerframework;

import java.io.*;
import java.net.MalformedURLException;
import java.net.URL;

/**
 *
 * @author Thor
 */
public class WebsiteReader {

    public static String read(String url){
        try {
            BufferedReader br = new BufferedReader(new InputStreamReader(new URL(url).openStream()));
            StringBuilder sb = new StringBuilder();
            String line = br.readLine();
            while(line != null){
                sb.append(line);
                line = br.readLine();
            }
            return sb.toString();
        } catch (MalformedURLException ex) {
            ex.printStackTrace();
        } catch(IOException ex){
            ex.printStackTrace();
        }
        return "Unable to read website!";
    }

}
